<template>
    <div class="material-library file-info">
        <pui-dialog :maskClick="false" :title="props.title" v-model="componentRef.dialogVisible" :animate="props.animate" isFooter @onCancel="closeDialog">
            <template #content>
                <div class="form">
                    <div class="form-item">
                        <div class="label">预选材料</div>
                        <pui-selector :dataList="componentRef.materialList" v-model="componentRef.material"></pui-selector>
                    </div>
                    <div class="form-item">
                        <div class="label">预选材料组分</div>
                        <pui-input disabled placeholder="默认路径" v-model="componentRef.material.data" type="input" full readonly></pui-input>
                    </div>
                </div>
            </template>
            <template #footer>
                <pui-button @click="submitHandle" type="primary">确定</pui-button>
                <pui-button @click="closeDialog">取消</pui-button>
            </template>
        </pui-dialog>
    </div>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
export default defineComponent({
    name: 'MaterialLibrary'
})
</script>
<script lang="ts" setup>
import { reactive, getCurrentInstance, watch } from 'vue'
const { proxy } = getCurrentInstance() as any
const props = defineProps({
    title: {
        type: String,
        default: '材料组分信息浏览'
    },
    animate: {
        type: String,
        default: 'fade'
    }
})
const emit = defineEmits({
    onClose: (val: any) => {}
})
const componentRef = reactive({
    dialogVisible: false,
    material: {},
    materialList: [
        {
          value: '1',
          label: 'InGaAsP/InP',
          data: 'In(1-x)Ga(x)As(y)P(1-y)/InP'
        },
        {
          value: '2',
          label: 'InGaAsP/GaAs',
          data: 'In(1-x)Ga(x)As(y)P(1-y)/GaAs'
        },
        {
          value: '3',
          label: 'InAlGaAs/InP',
          data: 'In(1-x-y)Al(x)Ga(y)As(1-y)/InP'
        },
        {
          value: '4',
          label: 'InAlGaAs/GaAs',
          data: 'In(1-x-y)Al(x)Ga(y)As(1-y)/GaAs'
        },
        {
          value: '5',
          label: 'InGaAs/AlGaAs/GaAs',
          data: 'In(x)Ga(1-x)As/Al(x)Ga(1-x)As/GaAs'
        },
    ]
}) as any
const init = () => {
    componentRef.dialogVisible = true
}
const closeDialog = () => {
    componentRef.dialogVisible = false
    emit('onClose', '关闭')
}
const submitHandle = () => {

}

defineExpose({
    init
})
</script>
<style lang="scss">
@import '../fileControl/fileStyle.scss';
</style>